package uk.co.richardwkirk.parkrun.funnels;

import uk.co.richardwkirk.parkrun.funnels.display.CommandLineDisplay;
import uk.co.richardwkirk.parkrun.funnels.display.DisplaySettings;
import uk.co.richardwkirk.parkrun.funnels.model.RaceFinisherException;

public class FunnelTestRunner {

	
	public static void main(String[] args) {

		// Get the parameters for the funnel test

		// Results file 
		String resultsFile = null;
		if (args.length >= 1) {
			resultsFile = args[0];
			System.out.println("Results file is " + resultsFile);
		}
		else {
			System.err.println("Please provide a results file.");
			System.exit(1);
		}
		
		// Create the test
		FunnelSettings funnelSettings = new FunnelSettings();
		DisplaySettings displaySettings = new DisplaySettings();
		try {
			FunnelTest funnelTest = new FunnelTest(funnelSettings, resultsFile);
			funnelTest.setDisplay(new CommandLineDisplay(displaySettings));
			funnelTest.runTest();
		} catch (RaceFinisherException e) {
			System.err.println("Could not build list of race finishers.");
			e.printStackTrace(System.err);
		}

	}
	
}
